#include "stdafx.h"			
#pragma once
//-------------------------------------------------------------------------------------------------
//ArchiveProcGUI.h : main header file for the ArchiveProcGUI application            
//-------------------------------------------------------------------------------------------------
//FreeBSD License
//Copyright 2011 Will Stott All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are
//permitted provided that the following conditions are met:
//
//   1. Redistributions of source code must retain the above copyright notice, this list of
//      conditions and the following disclaimer.
//
//   2. Redistributions in binary form must reproduce the above copyright notice, this list
//      of conditions and the following disclaimer in the documentation and/or other materials
//      provided with the distribution.
//
//THIS SOFTWARE IS PROVIDED BY Will Stott ``AS IS'' AND ANY EXPRESS OR IMPLIED
//WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
//FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Will Stott OR
//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
//ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
//ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//The views and conclusions contained in the software and documentation are those of the
//authors and should not be interpreted as representing official policies, either expressed
//or implied, of Will Stott.
//
//----Authors--------------------------------------------------------------------------------------
//created by: will.stott@ucl.ac.uk July 2011
//
//----Comments-------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------------------


#ifndef __AFXWIN_H__
	#error "include 'stdafx.h' before including this file for PCH"
#endif

#include <afxdatarecovery.h>
#include <string.h>

#include "resource.h"       // main symbols
#include <GdiPlus.h>

// CArchiveProcGUIApp:
// See ArchiveProcGUI.cpp for the implementation of this class
//

class CArchiveProcGUIApp : public CWinAppEx
{
	static const int AutoSavePeriodFactoryDefault = 300000;			//300,000 ms = 5mins
	static const int TempBuffLength=512;
public:
	CArchiveProcGUIApp();

	void		 RestoreFactorySettings();
	int		     GetAutoFileSavePeriod() {  return ((GetDataRecoveryHandler() != '\0') ?  (GetDataRecoveryHandler()->GetAutosaveInterval() /(1000 * 60)) : -1); }
	bool		 SetAutoFileSavePeriod(int minutes);
	bool		 IsAutoSaveEnabled()  { return (m_dwRestartManagerSupportFlags == (AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS)) ?  true : false; }


	CString		 GetDbConnection(TCHAR *Label);
	bool		 SetDbConnection(TCHAR *Label, CString &connectStr);
	CString		 GetImageDatasetFile();
	bool		 SetImageDatasetFile(CString &IdfFile);
	CString		 GetDataDir();
	bool		 SetDataDir(CString &DataDir);
	CString		 GetSQLStatementFile();
	bool		 SetSQLStatementFile(CString &SqlStatementFile);
	int			 GetImageSource();
	bool		 SetImageSource(int SourceType);
	CString		 GetImportImagesDir();
	bool		 SetImportImagesDir(CString &folder);

	CString		 GetIDFName();
	bool		 SetIDFName(CString &name);
	CString		 GetIDFOwner();
	bool		 SetIDFOwner(CString &email);
	CString		 GetIDFDescription();
	bool		 SetIDFDescription(CString &desc);
	CString		 GetIDFVersion();
	bool		 SetIDFVersion(CString &version);
	CString		 GetIDFRepository();
	bool		 SetIDFRepository(CString &repository);

	static const char *GetRunTimeTypeName(CObject *obj);
	static const char *GetImageName(const CString& PathFileName);
	static void		   UserErrorMsg(const char *errorType, const char *ErrorMsg, const char *RecoveryMsg, const char *SuggestedAction, UINT Prompt = MB_OK | MB_ICONEXCLAMATION );
	static int		   UserMsg(const char *Msg, const char *SuggestedAction = '\0', UINT Prompt = MB_OK | MB_ICONINFORMATION );

// Overrides
public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();

// Implementation
	BOOL  m_bHiColorIcons;

	virtual void PreLoadState();
	virtual void LoadCustomState();
	virtual void SaveCustomState();

	afx_msg void OnAppAbout();
	DECLARE_MESSAGE_MAP()
private:
		//GDI Plus Token
	ULONG_PTR					 m_gdiplusToken;
	Gdiplus::GdiplusStartupInput m_gdiplusStartupInput;


};

extern CArchiveProcGUIApp theApp;

//-------------------------------------------------------------------------------------------------
//			E N D   O F   F I L E
//-------------------------------------------------------------------------------------------------
